name: Test

on:
  pull_request:
    branches:
      - master
  push:
    branches-ignore:
      - master
    tags-ignore:
      - v*

jobs:
  test_ubuntu:
      runs-on: ubuntu-latest
      name: Test Ubuntu
      steps:
      - uses: actions/checkout@v2
      - name: Install Dependencies
        run: .github/scripts/install-ubuntu.sh
      - name: Build & Test
        run: .github/scripts/build-ubuntu.sh

  test_windows:
    runs-on: windows-2019
    name: Test Windows
    steps:
    - uses: actions/checkout@v2
    - name: Install Dependencies
      run: .github/scripts/install-windows.sh
      shell: bash
    - name: Build & Test
      run: .github/scripts/build-windows.sh
      shell: bash

  test_macos:
    runs-on: macos-latest
    name: Test macOS
    steps:
    - uses: actions/checkout@v2
    - name: Install Dependencies
      run: .github/scripts/install-macos.sh ci
    - name: Build & Test
      run: .github/scripts/build-macos.sh debug arm64 && .github/scripts/build-macos.sh debug x86_64

  test_flatpak:
    name: Test Flatpak x86_64
    runs-on: ubuntu-latest
    container:
      image: bilelmoussaoui/flatpak-github-actions:freedesktop-21.08
      options: --privileged
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: true
          fetch-depth: 0
      - uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v4
        with:
          bundle: "solvespace.flatpak"
          manifest-path: "pkg/flatpak/com.solvespace.SolveSpace.json"
          cache-key: flatpak-builder-${{ github.sha }}
